import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);

// import * as dd from "dingtalk-jsapi";

import NProgress from "nprogress";
import "nprogress/nprogress.css";

import home from "@/views/index";

// import bot from "./bot";
// import manual from "./manual";
// import dashboard from "./dashboard";

NProgress.configure({
  showSpinner: false,
});

const router = new Router({
  routes: [
    {
      path: "*",
      redirect: "/",
    },
    {
      path: "/",
      name: "home",
      component: home,
    },
    {
      path: "/hanzi",
      name: "hanzi",
      component: () => import("@/views/hanzi"),
    },
    {
      path: "/chengyu",
      name: "chengyu",
      component: () => import("@/views/chengyu"),
    },
    {
      path: "/shuxue/kousuan",
      name: "shuxue.kousuan",
      component: () => import("@/views/shuxue/kousuan"),
      meta: {
        title:"口算练习"
      }
    },
    // {
    //   path: "/kechengbiao",
    //   name: "kechengbiao",
    //   component: () => import("@/views/shuxue/kousuan"),
    // },
    // {
    //   path: "/qrcode/:text",
    //   name: "qrcode",
    //   component: () => import("../layouts/qrcode"),
    //   props: true,
    // },
    // ...bot,
    // ...manual,
    // ...dashboard,
  ],
  scrollBehavior() {
    return {
      x: 0,
      y: 0,
    };
  },
});

router.beforeEach((to, from, next) => {
  NProgress.start();
  document.title = to.meta?.title || "小学助手";
  next();
});

router.afterEach(() => {
  NProgress.done();
});

export default router;
